import { ref, onMounted } from 'vue'
import { getBanner } from '@/api/home'

export const useSlider = () => {
  /**
     * 1.定义轮播图数据变量
     * 2.定义获取轮播图数据的方法
     * 3.在组件挂载之后发请求
     */
  const list = ref([])
  const getList = async () => {
    const res = await getBanner()
    // console.log(res)
    list.value = res.result
  }
  onMounted(() => {
    getList()
  })
  return { list }
}
